package design.pattern.prototype.shallow;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @description: 具体原型类A
 * @author: liuzhangcheng
 **/
public class ConcretePrototypeA implements Prototype {
    private int id;
    private String name;
    private List likes;
    private LocalDateTime time;

    /**
     * 浅克隆
     * @return
     */
    @Override
    public Prototype clone() {
        ConcretePrototypeA obj = new ConcretePrototypeA();
        obj.id = this.id;
        obj.name = this.name;
        obj.likes = this.likes;
        obj.time = LocalDateTime.now();
        return obj;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List getLikes() {
        return likes;
    }

    public void setLikes(List likes) {
        this.likes = likes;
    }

    public LocalDateTime getTime() {
        return time;
    }

    public void setTime(LocalDateTime time) {
        this.time = time;
    }
}
